package com.js.domian.model.bot;

import cn.hutool.core.annotation.Alias;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import lombok.Data;

@Data
public class PrivateMessage {

    @Alias("post_type")
    private String eventType;

    @Alias("self_id")
    private Long botQq;

    @Alias("time")
    private Long time;

    @Alias("message_id")
    private Integer messageId;

    @Alias("message_type")
    private String messageType;

    @Alias("user_id")
    private Long userId;

    @Alias("sub_type")
    private String subType;

    @Alias("message")
    private JSONArray message;

    @Alias("raw_message")
    private String rawMessage;

    @Alias("font")
    private Integer font;

    @Alias("sender")
    private JSONObject sender;

    public static boolean isSupport(JSONObject jsonObject) {
        return ("message".equals(jsonObject.getStr("post_type"))
                && "private".equals(jsonObject.getStr("message_type")));
    }
}
